#include <Starter.hpp>
#include <Misc/Config.hpp>


/* Function prototype */
void printHelp();



int main(int argc, char** argv){

	/* Init config to handle parameter */
	Config::instance()->parseArguments(argc,argv);

	if(Config::instance()->isHelpFlag()){
		printHelp();
		return 0;
	}else{
		Starter starter;
		return starter.start();

	}

}

void printHelp(){

	std::cout << "IBRC-Server" << std::endl;
	std::cout << "Usage: ibrc_server [args]" << std::endl;
	std::cout << "Options:" << std::endl;
	std::cout << " -h --help\t\t\t\t Prints this help message." << std::endl;
	std::cout << " -n --name <SERVERNAME>" << std::endl;
	std::cout << " -pcl --port-client-listen <PORT>\t port for incoming client connections." << std::endl;
	std::cout << " -psl --port-server-listen <PORT>\t port for incoming server connections." << std::endl;
	std::cout << " -psc --port-server-connect <PORT>\t connection port for parent server enabled." << std::endl;
	std::cout << " -c\t\t\t\t\t connect to parent server." << std::endl;
	std::cout << " -a --address <ADDRESS>\t\t\t parent address to connect to." << std::endl;
	std::cout << " -i --info-file <FILE>\t\t\t server information file location." << std::endl;
	std::cout << " -r --raw-data-log-file <FILE>\t\t raw data log file location." << std::endl;
	std::cout << " -IPv6\t\t\t\t\t IPv6 support enabled (IPv4 by default)." << std::endl << std::endl;
}
